package work.huangxin.share.controller.sechand;

import io.minio.messages.ResponseDate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import work.huangxin.share.domain.sechand.SechandType;
import work.huangxin.share.service.SechandTypeService;
import work.huangxin.share.util.status.BaseResponse;
import work.huangxin.share.util.status.CodeEnum;
import work.huangxin.share.util.status.ResponseData;

import java.util.List;

/**
 * @author 季台星
 * @Date 2023 04 01 16 04
 */
@RestController
@RequestMapping("/wx/type")
public class SechandTypeController {
    @Autowired
    private SechandTypeService sechandTypeService;
    @GetMapping("getList")
    public BaseResponse getList(){
        List<SechandType> sechandTypeList = sechandTypeService.getList();
      return ResponseData.success(sechandTypeList);
    }
    @PostMapping("/delete/{typeId}")
    public BaseResponse deleteGoodsType(@PathVariable Integer typeId){
        int i = sechandTypeService.deleteType(typeId);
        if (i <= 0){
            ResponseData.error(CodeEnum.BODY_NOT_MATCH);
        }
        return ResponseData.success();
    }
}
